<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
            list-style: none;
        }
        div{
            width: 590px;
            height: 470px;
            margin: 100px auto;
            position: relative;
            overflow: hidden;
            
        }
        ul{
            width: 99999px;
            transform: translateX(0px);
        }
        ul li{
            float: left;
        }
        ol{
            position: absolute;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);

        }
        ol li{
            width: 10px;
            height: 10px;
            background:white;
            border-radius: 50%;
            float: left;
            margin: 0px 4px;
            cursor: pointer;
        }
        span{
            position:absolute;
            top: 50%;
            transform: translateY(-50%);
            background: wheat;
            border-radius: 50%;
            cursor: pointer;
        }
        span:nth-of-type(1){
            left: 10px;
        }
        span:nth-of-type(2){
            right:10px;
        }
        .cutton{
            background: #f60;
        }
    </style>
</head>
<body>
    <div id="wrap" >
        <ul id="box">
            <li><img src="images/60416d78df764e0c.jpg" alt=""></li>
            <li><img src="images/93fc422d6245805e.jpg" alt=""></li>
            <li><img src="images/e28b372846942e52.jpg" alt=""></li>
            <li><img src="images/q.jpg" alt=""></li>
            <li><img src="images/q8.jpg" alt=""></li>
        </ul>
        <ol id="list">
            <li class="cutton"></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ol>
        <span id="left">左</span>
        <span id="right">右</span>

        <script>
            var bxo=document.getElementById("box");
            var list=document.getElementById("list").children
            var num=0;
            var timer;
            function fn(){
                timer=setInterval(function(){
                    num++;
                    if(num>3){
                        num=0;
                    }
                    box.style.transform='translate('+(-590*num)+'px)';
                    for(var i=0;i<list.length;i++){
                        list[i].className='';
                    }
                    list[num].className='cutton'
                },1000)
            }
            fn()
            wrap.onmouseenter=function(){                 
                    clearInterval(timer)
                }
                wrap.onmouseleave=function(){
                    fn()
                }
            for(var n=0;n<list.length;n++){
                list[n].qwe=n
                list[n].onclick=function(){
                    for(var i=0;i<list.length;i++){
                        list[i].className='';
                    }
                    num=this.qwe
                    list[num].className='cutton' 
                    box.style.transform='translate('+(-590*num)+'px)';
                }
            }
            right.onclick=function(){
                num++;
                    if(num>3){
                        num=0;
                    }
                    box.style.transform='translate('+(-590*num)+'px)';
                    for(var i=0;i<list.length;i++){
                        list[i].className='';
                    }
                    list[num].className='cutton'
            }
            left.onclick=function(){
                num++;
                    if(num>3){
                        num=0;
                    }
                    box.style.transform='translate('+(-590*num)+'px)';
                    for(var i=0;i<list.length;i++){
                        list[i].className='';
                    }
                    list[num].className='cutton'
            }
        </script>
    </div>
</body>
</html>